﻿using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;

namespace ZyGame.Editor.AssetBuilder
{
    [PathOptions("ProjectSettings/AssetBuilderSetting.asset", PathOptions.Localtion.Project)]
    public class AssetBuilderSetting : Config<AssetBuilderSetting>
    {
        [SerializeField]
        [Header("打包基础配置")]
        public DefaultOption options;

        [SerializeField]
        [Header("资源服务器配置")]
        public List<UploadConfig> uploads;

        [SerializeField]
        [Header("配置导入设置")]
        public ImportConfigOptions ConfigOptions;

        public static string GetOutputFilePath(string name)
        {
            return $"{instance.options.output}/{AppConfig.GetPlatformName()}/{name}";
        }
    }

    [Serializable]
    public class DefaultOption
    {
        [Header("资源包输出地址")]
        public string output;

        [Header("资源版本缓存地址")]
        public string cachePath;

        [Header("最大缓存版本数")]
        public int maxCacheCount = 5;
    }

    [Serializable]
    public class ImportConfigOptions
    {
        public string importPath;
        public string nameSpace;
        public Object configDataOutput;
        public Object scriptOutput;
    }
}
